feat: add --reverse flag to temporal workflow show#988
feat: add --reverse flag to temporal workflow show#988veeral-patel wants to merge 1 commit intomainfrom
temporal workflow show#988Conversation
Fetches Event History newest-event-first via WorkflowService.GetWorkflowExecutionHistoryReverse, useful for inspecting recent activity on long-running workflows without pulling the full history. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
|
| "--follow", | ||
| ) | ||
| s.Error(res.Err) | ||
| s.ErrorContains(res.Err, "--reverse cannot be combined with --follow") |
There was a problem hiding this comment.
Not something for this PR, but it would be nice to have a way to generate MarkFlagsMutuallyExclusive in the yaml file below.
Seems like this is not currently supported for auto-gen but something the under lying framework supports.
| return nil, nil | ||
| } | ||
| s.reverseStarted = true | ||
| resp, err := s.client.WorkflowService().GetWorkflowExecutionHistoryReverse( |
There was a problem hiding this comment.
What is the default page size. For large history would be nice to allow customers to provide a custom size.
There was a problem hiding this comment.
the max page size configured on the server side is 256 (batches) I think.
| return nil, nil | ||
| } | ||
| s.reverseStarted = true | ||
| resp, err := s.client.WorkflowService().GetWorkflowExecutionHistoryReverse( |
There was a problem hiding this comment.
the max page size configured on the server side is 256 (batches) I think.
What changed?
This PR adds a
--reverseflag to thetemporal workflow showcommand that fetches Event History newest-event-first viaWorkflowService.GetWorkflowExecutionHistoryReverse. Useful for inspecting recent activity on long-running workflows without pulling the full history from the beginning.Files changed
internal/temporalcli/commands.yamlreversebool option undertemporal workflow showinternal/temporalcli/commands.gen.gomake gen— addsReversefield and--reverseflag registrationinternal/temporalcli/commands.workflow_view.go--reverse+--follow; passesreverseandnamespaceinto the history iteratorinternal/temporalcli/commands.workflow_exec.gostructuredHistoryIterwith a reverse code path that pages throughGetWorkflowExecutionHistoryReverse; skips continue-as-new traversal in reverse modeinternal/temporalcli/commands.workflow_view_test.go--reverse --followrejectionHow did you test it?
Unit tests
--reverseWorkflowExecutionCompletedprints beforeWorkflowExecutionStartedin stdout--reverse -o jsonevents[].eventIdis strictly decreasing across the array--follow--reverse --follow--reverse cannot be combined with --followManual tests
Setup
Forward (default) vs reverse — tabular
Events are listed newest-first when
--reverseis set.JSON reverse
eventIdvalues are strictly decreasing, matching reverse order.Detailed reverse
Per-event detail sections are rendered in reverse order.
Reject
--followNonexistent workflow
Error-path behavior is unchanged from the forward implementation.